{/* LAYOUT模板 */}
	<layout name="layout"/>
{/* LAYOUT模板 */}

{/* import Js,Css */}
	<js href="__PUBLIC__/js/admin/listTable.js"/>
	<css href="__PUBLIC__/css/admin/common.css"/>
	
	<css href="__PUBLIC__/css/jquery-ui.css" />
	<js href="__PUBLIC__/js/jquery-ui.1.10.4.js" />
	<js href="__PUBLIC__/js/core/plugins.js"/>
{/* import js,css */}

<!-- [position] -->
	<include file="Template:position"/>
<!-- [position] -->

<div class="main-div">
	<form action="__URL__/add_cat_ok" method="post" name="theForm" enctype="multipart/form-data" onsubmit="return validate()">
	<table width="100%" id="general-table">
		<tbody>	
			<tr>
				<td class="label">分类名称:</td>
				<td>
					<input type="text" name="cat_name" maxlength="20" value="" size="27"> 
					<font color="red">*</font>
				</td>
			</tr>
			<tr>
				<td class="label">上级分类:</td>
				<td>
					<select name="parent_id">
						<option value="0">顶级分类</option>
						<volist name="goodsCatList" id="goodsCat">
						<option value="{$goodsCat.cat_id}">{$goodsCat.cat_name}</option>
						</volist>      
					</select>
				</td>
			</tr>
			<tr id="measure_unit">
				<td class="label">数量单位:</td>
				<td>
					<input type="text" name="measure_unit" value="" size="12">
				</td>
			</tr>
			<tr>
				<td class="label">排序:</td>
				<td>
					<input type="text" name="sort_order" value="50" size="15">
				</td>
			</tr>
			<tr>
				<td class="label">是否显示:</td>
				<td>
					<input type="radio" name="is_show" value="1" checked="true"> 是          <input type="radio" name="is_show" value="0"> 否        </td>
			</tr>
			<tr>
				<td class="label">是否显示在导航栏:</td>
				<td>
					<input type="radio" name="show_in_nav" value="1"> 是          <input type="radio" name="show_in_nav" value="0" checked="true"> 否        </td>
			</tr>
			<tr class="hide">
				<td class="label">设置为首页推荐:</td>
				<td>
					<input type="checkbox" name="cat_recommend[]" value="1"> 精品          <input type="checkbox" name="cat_recommend[]" value="2"> 最新          <input type="checkbox" name="cat_recommend[]" value="3"> 热门        </td>
			</tr>
			<tr>
				<td class="label">
					<a href="javascript:showNotice('noticeFilterAttr');" title="点击此处查看提示信息">
						<img src="images/notice.gif" width="16" height="16" border="0" alt="您可以为每一个商品分类指定一个样式表文件。例如文件存放在 themes 目录下则输入：themes/style.css">
					</a>筛选属性:
				</td>
				<td>         
					<table width="100%" id="tbody-attr" align="center">
						<tbody>
							<tr>
								<td>   
									<a href="javascript:;" onclick="addFilterAttr(this)">[+]</a> 
									<select onchange="changeCat(this)">
										<option value="0">请选择商品类型</option>
										<volist name="goodsTypeList" id="goodsType">
										<option value="{$goodsType.cat_id}">{$goodsType.cat_name}</option>
										</volist>
									</select>
									&nbsp;&nbsp;
									<select name="filter_attr[]">
										<option value="0">请选择筛选属性</option>
									</select>
									<br>                   
								</td>
							</tr> 
                       
						</tbody>
					</table>
					<span class="notice-span" style="display:block" id="noticeFilterAttr">筛选属性可在前分类页面筛选商品</span>
				</td>
			</tr>
			<tr>
				<td class="label">
					<a href="javascript:showNotice('noticeGrade');" title="点击此处查看提示信息">
						<img src="images/notice.gif" width="16" height="16" border="0" alt="您可以为每一个商品分类指定一个样式表文件。例如文件存放在 themes 目录下则输入：themes/style.css">
					</a>价格区间个数:
				</td>
				<td>
					<input type="text" name="grade" value="0" size="40"> <br>
					<span class="notice-span" style="display:block" id="noticeGrade">该选项表示该分类下商品最低价与最高价之间的划分的等级个数，填0表示不做分级，最多不能超过10个。</span>
				</td>
			</tr>
			<tr>
				<td class="label">
					<a href="javascript:showNotice('noticeGoodsSN');" title="点击此处查看提示信息">
						<img src="images/notice.gif" width="16" height="16" border="0" alt="您可以为每一个商品分类指定一个样式表文件。例如文件存放在 themes 目录下则输入：themes/style.css">
					</a>分类的样式表文件:
				</td>
				<td>
					<input type="text" name="style" value="" size="40"> <br>
					<span class="notice-span" style="display:block" id="noticeGoodsSN">您可以为每一个商品分类指定一个样式表文件。例如文件存放在 themes 目录下则输入：themes/style.css</span>
				</td>
			</tr>
			<tr>
				<td class="label">关键字:</td>
				<td>
					<input type="text" name="keywords" value="" size="50">
				</td>
			</tr>
			<tr>
				<td class="label">分类描述:</td>
				<td>
					<textarea name="cat_desc" rows="6" cols="48"></textarea>
				</td>
			</tr>
		</tbody>
	</table>
    <div class="button-div">
        <input type="submit" value=" 确定 ">
        <input type="reset" value=" 重置 ">
    </div>
    <input type="hidden" name="act" value="insert">
    <input type="hidden" name="old_cat_name" value="">
    <input type="hidden" name="cat_id" value="">
  </form>
</div>

<script type="text/javascript">
        var arr = new Array();
        var sel_filter_attr = "请选择筛选属性";
		arr[1] = new Array();
		arr[1][0] = ["版次", 9];
		arr[1][1] = ["开本", 5];
		arr[1][2] = ["作者", 1];
		arr[1][3] = ["所属分类", 12];
		arr[1][4] = ["图书规格", 8];
		arr[1][5] = ["出版日期", 4];
		arr[1][6] = ["字数", 11];
		arr[1][7] = ["图书装订", 7];
		arr[1][8] = ["图书书号/ISBN", 3];
		arr[1][9] = ["印张", 10];
		arr[1][10] = ["图书页数", 6];
		arr[1][11] = ["出版社", 2];
		
		arr[2] = new Array();
		arr[2][0] = ["片装数", 17];
		arr[2][1] = ["中文片名", 13];
		arr[2][2] = ["出版", 28];
		arr[2][3] = ["歌词", 24];
		arr[2][4] = ["导演/指挥", 20];
		arr[2][5] = ["介质/格式", 16];
		arr[2][6] = ["版权号", 31];
		arr[2][7] = ["发行公司", 27];
		arr[2][8] = ["长度", 23];
		arr[2][9] = ["语种", 19];
		arr[2][10] = ["商品别名", 15];
		arr[2][11] = ["引进号", 30];
		arr[2][12] = ["ISRC码", 26];
		arr[2][13] = ["所属类别", 22];
		arr[2][14] = ["国家地区", 18];
		arr[2][15] = ["英文片名", 14];
		arr[2][16] = ["出版号", 29];
		arr[2][17] = ["碟片代码", 25];
		arr[2][18] = ["主唱", 21];
		
		arr[3] = new Array();
		arr[3][0] = ["中文片名", 32];
		arr[3][1] = ["音频格式", 47];
		arr[3][2] = ["导演", 43];
		arr[3][3] = ["语种/配音", 39];
		arr[3][4] = ["引进号", 54];
		arr[3][5] = ["介质/格式", 35];
		arr[3][6] = ["ISRC码", 50];
		arr[3][7] = ["年份", 46];
		arr[3][8] = ["中文字幕", 42];
		arr[3][9] = ["国家地区", 38];
		arr[3][10] = ["出版号", 53];
		arr[3][11] = ["商品别名", 34];
		arr[3][12] = ["碟片代码", 49];
		arr[3][13] = ["所属类别", 45];
		arr[3][14] = ["色彩", 41];
		arr[3][15] = ["片装数", 37];
		arr[3][16] = ["出版 ", 52];
		arr[3][17] = ["英文片名", 33];
		arr[3][18] = ["区码", 48];
		arr[3][19] = ["表演者", 44];
		arr[3][20] = ["字幕", 40];
		arr[3][21] = ["版权号", 55];
		arr[3][22] = ["碟片类型", 36];
		arr[3][23] = ["发行公司", 51];
		
		arr[4] = new Array();
		arr[4][0] = ["价格等级", 81];
		arr[4][1] = ["清晰度", 62];
		arr[4][2] = ["铃声", 77];
		arr[4][3] = ["尺寸体积", 58];
		arr[4][4] = ["WAP上网", 73];
		arr[4][5] = ["操作系统", 69];
		arr[4][6] = ["宽度", 65];
		arr[4][7] = ["红外/蓝牙", 80];
		arr[4][8] = ["副屏参数/外屏参数", 61];
		arr[4][9] = ["随机配件", 76];
		arr[4][10] = ["支持频率/网络频率", 57];
		arr[4][11] = ["标准配置", 72];
		arr[4][12] = ["内存容量", 68];
		arr[4][13] = ["长度", 64];
		arr[4][14] = ["彩信/彩e", 79];
		arr[4][15] = ["主屏参数/内屏参数", 60];
		arr[4][16] = ["天线位置", 75];
		arr[4][17] = ["网络制式", 56];
		arr[4][18] = ["待机时间", 71];
		arr[4][19] = ["屏幕材质", 67];
		arr[4][20] = ["色数/灰度", 63];
		arr[4][21] = ["摄像头", 78];
		arr[4][22] = ["外观样式/手机类型", 59];
		arr[4][23] = ["数据业务", 74];
		arr[4][24] = ["通话时间", 70];
		arr[4][25] = ["厚度", 66];
		
		arr[5] = new Array();
		arr[5][0] = ["显卡显存", 96];
		arr[5][1] = ["硬盘", 92];
		arr[5][2] = ["系统总线", 88];
		arr[5][3] = ["笔记本尺寸", 84];
		arr[5][4] = ["电池容量", 99];
		arr[5][5] = ["标称频率", 95];
		arr[5][6] = ["内存类型", 91];
		arr[5][7] = ["二级缓存", 87];
		arr[5][8] = ["详细规格", 83];
		arr[5][9] = ["光驱类型", 98];
		arr[5][10] = ["显示芯片", 94];
		arr[5][11] = ["内存容量", 90];
		arr[5][12] = ["处理器最高主频", 86];
		arr[5][13] = ["型号", 82];
		arr[5][14] = ["显卡类型", 97];
		arr[5][15] = ["屏幕尺寸", 93];
		arr[5][16] = ["主板芯片组", 89];
		arr[5][17] = ["处理器类型", 85];
		arr[5][18] = ["其他配置", 100];
		
		arr[6] = new Array();
		arr[6][0] = ["最高分辨率", 111];
		arr[6][1] = ["连拍", 126];
		arr[6][2] = ["兼容操作系统", 141];
		arr[6][3] = ["显示屏类型", 107];
		arr[6][4] = ["曝光控制", 122];
		arr[6][5] = ["电池使用时间", 137];
		arr[6][6] = ["有效像素", 103];
		arr[6][7] = ["旋转液晶屏", 118];
		arr[6][8] = ["场景模式", 133];
		arr[6][9] = ["传感器尺寸", 114];
		arr[6][10] = ["拍摄范围", 129];
		arr[6][11] = ["感光器件尺寸", 110];
		arr[6][12] = ["白平衡", 125];
		arr[6][13] = ["标准配件", 140];
		arr[6][14] = ["操作模式", 106];
		arr[6][15] = ["影像格式", 121];
		arr[6][16] = ["电源", 136];
		arr[6][17] = ["最大像素/总像素  ", 102];
		arr[6][18] = ["焦距", 117];
		arr[6][19] = ["测光模式", 132];
		arr[6][20] = ["传感器类型", 113];
		arr[6][21] = ["闪光灯", 128];
		arr[6][22] = ["感光器件", 109];
		arr[6][23] = ["曝光补偿", 124];
		arr[6][24] = ["标配软件", 139];
		arr[6][25] = ["数字变焦倍数", 105];
		arr[6][26] = ["存储卡", 120];
		arr[6][27] = ["外接接口", 135];
		arr[6][28] = ["类型", 101];
		arr[6][29] = ["光圈", 116];
		arr[6][30] = ["ISO感光度", 131];
		arr[6][31] = ["图像分辨率", 112];
		arr[6][32] = ["快门速度", 127];
		arr[6][33] = ["显示屏尺寸", 108];
		arr[6][34] = ["曝光模式", 123];
		arr[6][35] = ["外形尺寸", 138];
		arr[6][36] = ["光学变焦倍数", 104];
		arr[6][37] = ["存储介质", 119];
		arr[6][38] = ["短片拍摄", 134];
		arr[6][39] = ["镜头", 115];
		arr[6][40] = ["自拍定时器", 130];
		
		arr[7] = new Array();
		arr[7][0] = ["最大像素数", 145];
		arr[7][1] = ["曝光控制", 160];
		arr[7][2] = ["取景器", 156];
		arr[7][3] = ["像素范围", 152];
		arr[7][4] = ["显示屏尺寸及类型", 148];
		arr[7][5] = ["电池类型", 163];
		arr[7][6] = ["外型尺寸", 144];
		arr[7][7] = ["对焦方式", 159];
		arr[7][8] = ["水平清晰度", 155];
		arr[7][9] = ["感光器件数量", 151];
		arr[7][10] = ["数字变焦倍数", 147];
		arr[7][11] = ["随机存储", 162];
		arr[7][12] = ["类型", 143];
		arr[7][13] = ["镜头性能", 158];
		arr[7][14] = ["传感器尺寸", 154];
		arr[7][15] = ["感光器件尺寸", 150];
		arr[7][16] = ["光学变焦倍数", 146];
		arr[7][17] = ["其他接口", 161];
		arr[7][18] = ["编号", 142];
		arr[7][19] = ["数码效果", 157];
		arr[7][20] = ["传感器数量", 153];
		arr[7][21] = ["感光器件", 149];
		arr[7][22] = ["电池供电时间", 164];
		
		arr[8] = new Array();
		arr[8][0] = ["适用人群", 171];
		arr[8][1] = ["主要原料", 167];
		arr[8][2] = ["适合肤质", 170];
		arr[8][3] = ["产品规格/容量", 166];
		arr[8][4] = ["使用部位", 169];
		arr[8][5] = ["产地", 165];
		arr[8][6] = ["所属类别", 168];
		
		arr[9] = new Array();
		arr[9][0] = ["浏览器", 209];
		arr[9][1] = ["中文输入法", 190];
		arr[9][2] = ["CPU频率", 205];
		arr[9][3] = ["屏幕颜色", 186];
		arr[9][4] = ["变焦模式", 201];
		arr[9][5] = ["操作系统", 182];
		arr[9][6] = ["办公功能", 197];
		arr[9][7] = ["蓝牙接口", 193];
		arr[9][8] = ["闪光灯", 208];
		arr[9][9] = ["屏幕大小", 189];
		arr[9][10] = ["视频播放", 204];
		arr[9][11] = ["颜色", 185];
		arr[9][12] = ["传感器", 200];
		arr[9][13] = ["内存容量", 181];
		arr[9][14] = ["网络链接", 192];
		arr[9][15] = ["耳机接口", 207];
		arr[9][16] = ["屏幕分辨率", 188];
		arr[9][17] = ["MP3播放器", 203];
		arr[9][18] = ["尺寸体积", 184];
		arr[9][19] = ["像素", 199];
		arr[9][20] = ["存储卡格式", 180];
		arr[9][21] = ["电子邮件", 195];
		arr[9][22] = ["配件", 210];
		arr[9][23] = ["情景模式", 191];
		arr[9][24] = ["收音机", 206];
		arr[9][25] = ["上市日期", 172];
		arr[9][26] = ["屏幕材质", 187];
		arr[9][27] = ["视频拍摄", 202];
		arr[9][28] = ["K-JAVA", 183];
		arr[9][29] = ["数码相机", 198];
		arr[9][30] = ["数据线接口", 194];
		arr[9][31] = ["手机制式", 173];
		arr[9][32] = ["理论通话时间", 174];
		arr[9][33] = ["理论待机时间", 175];
		arr[9][34] = ["铃声", 176];
		arr[9][35] = ["铃声格式", 177];
		arr[9][36] = ["外观样式", 178];
		arr[9][37] = ["中文短消息", 179];
		arr[9][38] = ["闹钟", 196];
                                    
	function changeCat(obj){
		var key = obj.value;
		var sel = window.ActiveXObject ? obj.parentNode.childNodes[4] : obj.parentNode.childNodes[5];
		sel.length = 0;
		sel.options[0] = new Option(sel_filter_attr, 0);
		if (arr[key] == undefined){
			return;
		}
		for (var i= 0; i < arr[key].length ;i++ ){
			sel.options[i+1] = new Option(arr[key][i][0], arr[key][i][1]);
		}
	}
	<!--
	document.forms['theForm'].elements['cat_name'].focus();
	/**
	 * 检查表单输入的数据
	 */
	function validate()
	{
	  validator = new Validator("theForm");
	  validator.required("cat_name",      catname_empty);
	  if (parseInt(document.forms['theForm'].elements['grade'].value) >10 || parseInt(document.forms['theForm'].elements['grade'].value) < 0)
	  {
		validator.addErrorMsg('价格分级数量只能是0-10之内的整数');
	  }
	  return validator.passed();
	}


	/**
	 * 新增一个筛选属性
	 */
	function addFilterAttr(obj)
	{
	  var src = obj.parentNode.parentNode;
	  var tbl = document.getElementById('tbody-attr');

	  var validator  = new Validator('theForm');
	  var filterAttr = document.getElementsByName("filter_attr[]");

	  if (filterAttr[filterAttr.length-1].selectedIndex == 0)
	  {
		validator.addErrorMsg(filter_attr_not_selected);
	  }
	  
	  for (i = 0; i < filterAttr.length; i++)
	  {
		for (j = i + 1; j <filterAttr.length; j++)
		{
		  if (filterAttr.item(i).value == filterAttr.item(j).value)
		  {
			validator.addErrorMsg(filter_attr_not_repeated);
		  } 
		} 
	  }

	  if (!validator.passed())
	  {
		return false;
	  }

	  var row  = tbl.insertRow(tbl.rows.length);
	  var cell = row.insertCell(-1);
	  cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addFilterAttr)(.*)(\[)(\+)/i, "$1removeFilterAttr$3$4-");
	  filterAttr[filterAttr.length-1].selectedIndex = 0;
	}

	/**
	 * 删除一个筛选属性
	 */
	function removeFilterAttr(obj)
	{
	  var row = rowindex(obj.parentNode.parentNode);
	  var tbl = document.getElementById('tbody-attr');

	  tbl.deleteRow(row);
	}
	//-->

		  
		  
		  
		  

</script>
